/** *******************************************************************
 * FlexDatabaseManager
 * Copyright (c) 2008 Jonnie Spratley. All Rights Reserved.
 * @author  Jonnie Spratley
 * @contact jonniespratley@gmail.com
 * @internal
 ******************************************************************* */
package com.jonniespratley.flexdatabasemanager.commands.tables
{
	import com.adobe.cairngorm.commands.ICommand;
	import com.adobe.cairngorm.control.CairngormEvent;

	import com.jonniespratley.flexdatabasemanager.events.tables.AlterTableEvent;
	import com.jonniespratley.flexdatabasemanager.model.ModelLocator;
	import com.jonniespratley.flexdatabasemanager.vo.*;

	import mx.rpc.events.FaultEvent;
	import mx.rpc.events.ResultEvent;
	import mx.rpc.AsyncToken;
	import mx.rpc.IResponder;
	import mx.controls.Alert;
	import mx.collections.ArrayCollection;

	/**
	 * For every feature or use case in your application, a corresponding custom command
	 * and event must be created. Each command contains an execute() method that is run
	 * by the framework when the user action has been executed.
	 * These classes are occasionally referred to as worker classes because they carry
	 * out the work for an application.
	 *
	 */
	public class AlterTableCommand implements ICommand
	{
		private var model:ModelLocator = ModelLocator.getInstance();

		public function execute( event:CairngormEvent ) : void
		{
			var evt:AlterTableEvent = event as AlterTableEvent;
			model.interactingWithServer = true;
			
			//ALTER TABLE test.cars DROP model;
			//ALTER TABLE `posts` CHANGE `id` `id` int(10) UNSIGNED NOT NULL auto_increment;
			//ALTER TABLE `posts` CHANGE `smample` `smample` varchar(12) DEFAULT NULL ;
			//ALTER TABLE `posts` ADD `createdCopy` datetime DEFAULT NULL ;
			//todo: implement alteraterations
		}
	}
}
